import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
import matplotlib
img=cv.imread("../imgs/cat.jpeg",0)
#统计灰度图:(图像,通道,掩膜图像，bin的数目，像素值范围)
histr=cv.calcHist([img],[0],None,[256],[0,256])
plt.figure(figsize=(10,6),dpi=100)
plt.plot(histr)
plt.grid()
plt.show()
